Skip to content

fix: handle null start/end times in basic_rates - #3722

Merged
springfall2008 merged 1 commit into
mainfrom
fix/null-flat-rate-times
Apr 2, 2026
Merged

springfall2008 merged 1 commit into
mainfrom
fix/null-flat-rate-times

Conversation

@mgazza

@mgazza mgazza commented Apr 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • dict.get("start", "00:00:00") returns None when the key exists with an explicit null value — the default only applies when the key is missing entirely
  • Use or "00:00:00" to fall back for both missing and null start/end times in rate entries
  • Also guards the return value of resolve_arg() which can return None in edge cases

Context

Customer on manual_v2 energy provider with a flat export rate — the tariff wizard saved "start": null, "end": null for the flat rate entry, causing:

AttributeError: 'NoneType' object has no attribute 'count'
  File "/addon/fetch.py", line 1554, in basic_rates
    if start_str.count(":") < 2:

Test plan

  • Existing basic_rates tests still pass
  • Flat rate with null start/end no longer crashes

🤖 Generated with Claude Code

dict.get("start", "00:00:00") returns None when the key exists with
an explicit null value. Use `or` to fall back to "00:00:00" for both
missing and null start/end times in rate entries.

Fixes crash: AttributeError: 'NoneType' object has no attribute 'count'

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mgazza

mgazza commented Apr 2, 2026

Copy link
Copy Markdown
Collaborator Author

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

@springfall2008
springfall2008 merged commit b80fc2a into main Apr 2, 2026
1 check passed
@springfall2008
springfall2008 deleted the fix/null-flat-rate-times branch April 2, 2026 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants